import time
import re
import requests
import execjs
jsp = int(time.time()*1000)
url = 'https://eip.chanfine.com/resource/js/session.jsp?_='+str(jsp)
headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36'
}

req = requests.get(url,headers=headers).text
ex = '"(.*)"'
pub_key = re.findall(ex, req)[0]

node = execjs.get()
ctx = node.compile(open('/Users/lidong/Desktop/zhouyu/BILIBILI/笔记/爬虫/chanfan.js', encoding='utf-8').read())
funcName = "getpwd('{0}','{1}')".format("123456",  pub_key)
password = ctx.eval(funcName)
print(password)